Repository navigation
fix(fleet-queue): parse_ts rejects impossible dates - #6684
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 21 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9df8a5ead0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| fn parse_ts_rejects_impossible_dates() { | ||
| // #6667: days that do not exist in their month/year must be | ||
| // rejected, not normalized into the next month. Oracle: the | ||
| // Gregorian calendar, as in the ts_round_trip controls below. | ||
| for s in [ |
There was a problem hiding this comment.
Add property-based coverage for the calendar invariant
The new day-validity invariant is covered only by hand-written examples. Root AGENTS.md explicitly requires property-based coverage for meaningful parser invariants and says example tests do not replace it. Add a generated year/month/day test with an independent Gregorian-calendar oracle that checks valid-date acceptance and impossible-date rejection, including leap-year and century boundaries. The existing ts_round_trip uses fixed examples, while fold_invariants tests claim-state folding rather than timestamp parsing.
AGENTS.md reference: AGENTS.md:L41-L45
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 234e448: added property-based coverage for the calendar invariant, per the repo testing doctrine.
parse_ts_accepts_exactly_real_dates(proptest over year 1600..2400 × month × day 1..=31): parse_ts accepts a triple iff the day exists. Oracle: the inverse pairdays_from_civil/civil_from_days— a triple is a real date iff the round trip returns it unchanged (normalization moves impossible dates, so their round trip differs); valid triples must also parse to exactlydays_from_civil * 86400.ts_round_trip_any_epoch(proptest over arbitrary epochs):parse_ts(format_ts(e)) == Some(e).
Laptop: cargo test -p fleet-queue --features client — 40 passed, 0 failed.
Fixes #6667.
parse_tsinpkgs/fleet/crates/fleet-queue/src/fallback.rsvalidated the day field only as1..=31, so impossible dates (2026-02-31, non-leap 2026-02-29, 2026-04-31) silently normalized viadays_from_civilinto the next month — shifting a fallback claim marker's authoritativets, and with it all lease math, by up to ~3 days.Change:
None.parse_ts_rejects_impossible_dates(oracle: the Gregorian calendar) covering Feb 30/31, non-leap and century Feb 29, Apr/Jun/Sep/Nov 31, day 0 and day 32, with valid month-end/leap controls (2024-02-29, 2000-02-29, 2026-02-28, 2026-04-30, 2026-01-31).Tests (laptop):
cargo test -p fleet-queue --features client— 38 passed, 0 failed, including the new test and the existingts_round_tripround-trip property set.Filed/fixed in fleet queue fallback mode (queue backend down, code#6619): issue #6667 carries the claim markers.
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.